package org.bw.bookstore.book.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.bw.bookstore.book.service.WarningRecordService;
import org.bw.bookstore.common.entity.TbAlarmRecord;
import org.bw.bookstore.common.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * @Author GuoShuai
 * @Date 2020-10-22 下午 02:30
 * 用户逃单控制类
 * @Version 1.0
 **/
@Api(tags = "接口-用户逃单记录")
@RestController
@CrossOrigin
@Slf4j
@RequestMapping("/userFlowRecord")
public class WarningRecordController {
    @Autowired
    WarningRecordService waringRecordService;
    /**
     * TODO 郭帅帅 保存用户恶意离店记录
     * @Description:
     * @Author: guoshuai
     * @Date: 2020-10-20 上午 10:13
     * @param facePath: 传入当前用户的照片
     * @return: void
     **/
    @ApiOperation(value = "存储用户逃单记录", notes = "存储用户逃单记录")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "facePath", value = "当前用户", dataType = "AlarmRecord", required = true),
    })
    @PostMapping ("/chargeback")
    public ResponseResult chargebackRecord(@ApiIgnore TbAlarmRecord facePath){
        return waringRecordService.chargebackRecord(facePath);
    };
    /**
     * TODO 郭帅帅 用户恶意离店记录查询
     * @Description:
     * @Author: guoshuai
     * @Date: 2020-10-20 上午 10:13
     * @return: void
     **/
    @ApiOperation(value = "查询逃单记录", notes = "查询逃单记录")
    @GetMapping("/selectchargeback")
    public ResponseResult selectChargebackRecord(){
        return waringRecordService.selectChargebackRecord();
    };
}
